home *** CD-ROM | disk | FTP | other *** search
- #ifndef FWICON_H
- #define FWICON_H
-
- //========================================================================================
- //
- // File: FWIcon.h
- // Release Version: $ 1.0d11 $
- //
- // Copyright: © 1993, 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export on
- #endif
-
- #ifndef FWGROBJ_H
- #include "FWGrObj.h"
- #endif
-
- #ifndef FWGRDEF_H
- #include "FWGrDef.h"
- #endif
-
- //========================================================================================
- // Forward Declarations
- //========================================================================================
-
- class FW_CLASS_ATTR FW_CResourceFile;
- class FW_CLASS_ATTR FW_CGraphicContext;
- class FW_CLASS_ATTR FW_CRect;
- class FW_CLASS_ATTR FW_CPoint;
-
- class FW_CLASS_ATTR FW_PIcon;
- class FW_CLASS_ATTR FW_CIconRep;
-
- //========================================================================================
- // class FW_PIcon
- //========================================================================================
-
- class FW_CLASS_ATTR FW_PIcon : public FW_CGraphicCountedPtr
- {
- public:
- FW_DECLARE_CLASS
-
- FW_PIcon();
- FW_PIcon(FW_CReadableStream& archive);
- FW_PIcon(FW_PlatformIcon platformIcon);
- FW_PIcon(FW_CResourceFile& resourceFile,
- FW_ResourceId resId,
- short size);
- virtual ~FW_PIcon();
-
- FW_PIcon(const FW_PIcon& other);
- FW_PIcon& operator=(const FW_PIcon& other);
-
- FW_CIconRep* operator->();
- const FW_CIconRep* operator->() const;
- };
-
- //========================================================================================
- // class FW_CIconRep
- //========================================================================================
-
- class FW_CLASS_ATTR FW_CIconRep : public FW_CGraphicCountedPtrRep
- {
- public:
- FW_DECLARE_CLASS
-
- friend FW_PIcon;
-
- //----------------------------------------------------------------------------------------
- // Constructors/Destructors
- //
- protected:
- FW_CIconRep(FW_PlatformIcon platformIcon);
- FW_CIconRep(FW_CResourceFile& resourceFile,
- FW_ResourceId resId,
- short size);
-
- FW_CIconRep(FW_CReadableStream& archive);
-
- virtual ~FW_CIconRep();
-
- //----------------------------------------------------------------------------------------
- // Inherited API
- //
- public:
- virtual void Flatten(FW_CWritableStream& archive) const;
- virtual FW_Boolean IsEqual(const FW_CGraphicCountedPtrRep* other) const;
-
- //----------------------------------------------------------------------------------------
- // New API
- //
- public:
- // ----- Copying -----
- FW_PIcon Copy() const;
-
- // ----- Get, Set, Adopt and Orphan
- FW_PlatformIcon GetPlatformIcon() const;
- FW_PlatformIcon OrphanPlatformIcon();
-
- void SetPlatformIcon(FW_PlatformIcon newIcon);
- void AdoptPlatformIcon(FW_PlatformIcon newIcon);
-
- // ----- Archiving -----
- static void* Read(FW_CReadableStream& archive);
-
- // ---- Geometry -----
- void GetIconSize(FW_CPoint& size) const; // Size in pixels
- void GetIconSize(FW_CGraphicContext& gc, FW_CPoint& size) const; // Size in gc units
-
- //----------------------------------------------------------------------------------------
- // Implementation
- //
- protected:
- void DisposePlatformIcon();
-
- static FW_PlatformIcon CopyPlatformIcon(FW_PlatformIcon icon);
- static short GetPlatformIconSize(FW_PlatformIcon icon);
-
- private:
- FW_Boolean fOwnIcon;
- FW_PlatformIcon fPlatformIcon;
- short fIconSize;
- };
-
- //========================================================================================
- // Inlines
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // FW_PIcon::operator->
- //----------------------------------------------------------------------------------------
-
- inline FW_CIconRep* FW_PIcon::operator->()
- {
- return (FW_CIconRep*) GetRep();
- }
-
- //----------------------------------------------------------------------------------------
- // FW_PIcon::operator->
- //----------------------------------------------------------------------------------------
-
- inline const FW_CIconRep* FW_PIcon::operator->() const
- {
- return (const FW_CIconRep*) GetRep();
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CIconRep::GetPlatformIcon
- //----------------------------------------------------------------------------------------
-
- inline FW_PlatformIcon FW_CIconRep::GetPlatformIcon() const
- {
- return fPlatformIcon;
- }
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export off
- #endif
-
- #endif // FWICON_H
-
-